<?php
/**
 * Created by PhpStorm.
 * User: wenwenbin
 * Date: 2018/2/2
 * Time: 13:52
 */
namespace App\Http\Admin\Administration\Controllers;

use App\Http\Admin\Administration\Models\CarUse;
use Framework\BaseClass\Http\Admin\Controller;

class GoodsBorrowingController extends Controller
{
    public function goodsBorrowingList()
    {
        if (request()->isMethod('post')) {
            $paging = $this->getPagingRequestParameters();
            $carUse = new CarUse();
            return $carUse->goodsBorrowingList($paging);
        }
        return $this->view('goods-borrowing-list');
    }
    
    public function goodsBorrowingAdd()
    {
        if (request()->isMethod('post')) {
            $params = request()->only(['name']);
            $carUse = new CarUse();
            try {
                $result = true;
                return $result ? $this->ajaxSuccess() : $this->ajaxFail();
            } catch (\DebugError $e) {
                return $this->ajaxFail($e->getMessage());
            }
        }
        return $this->view('goods-borrowing-add');
    }
    
    public function goodsBorrowingEdit()
    {
        $params = request()->only(['id', 'name']);
        $carUse = new CarUse();
        try {
            if (request()->isMethod('post')) {
                $result = true;
                return $result ? $this->ajaxSuccess() : $this->ajaxFail();
            }
        } catch (\DebugError $e) {
            return $this->ajaxFail($e->getMessage());
        }
        return $this->view('goods-borrowing-edit');
    }
}